import './App.css';
import React, { lazy, Suspense } from 'react'
import { Route, Routes, Navigate } from 'react-router-dom'
import RouterView from './router/Index'

// var Index = lazy(() => import('./views/Index'))
// var Login = lazy(() => import('./views/login'))
// var Tel = lazy(() => import('./views/Reg/Tel'))
// var Code = lazy(() => import('./views/Reg/Code'))
// var Password = lazy(() => import('./views/Reg/Password'))
// var Details = lazy(() => import('./views/Details'))
// var NotFount = lazy(() => import('./views/NotFound'))
// var Address = lazy(() => import('./views/Address'))

// var Home = lazy(() => import('./views/index/Home'))
// var Classify = lazy(() => import('./views/index/Classify'))
// var Shopcart = lazy(() => import('./views/index/Shopcart'))
// var Mine = lazy(() => import('./views/index/Mine'))

function App() {
  return (
    <div className="App">

      {/* <Suspense fallback={<h2>Loading..</h2>}>
        <Routes>
          <Route path='/index' element={<Index />}>
            <Route path='/index/home' element={<Home />}></Route>
            <Route path='/index/classify' element={<Classify />}></Route>
            <Route path='/index/shopcart' element={<Shopcart />}></Route>
            <Route path='/index/mine' element={<Mine />}></Route>
            <Route path="/index" element={<Navigate to="/index/home" />} />
          </Route>
          <Route path='/login' element={<Login />}></Route>
          <Route path='/reg' element={<Tel />}></Route>
          <Route path='/code' element={<Code />}></Route>
          <Route path='/password' element={<Password />}></Route>
          <Route path='/details/:id' element={<Details />}></Route>
          <Route path='/address' element={<Address />}></Route>
          <Route path="/" element={<Navigate to="/index" />} />
          <Route path='*' element={<NotFount />}></Route>
        </Routes>
      </Suspense> */}

      <Suspense fallback={<h2>Loading..</h2>}>
        <RouterView></RouterView>
      </Suspense>

    </div>
  );
}

export default App;

